Skip to content

Fall back to runtime/debug.ReadBuildInfo for version info (#71)#72

Merged
devrimcavusoglu merged 1 commit into
mainfrom
fix/71-version-go-install
Apr 13, 2026
Merged

Fall back to runtime/debug.ReadBuildInfo for version info (#71)#72
devrimcavusoglu merged 1 commit into
mainfrom
fix/71-version-go-install

Conversation

@devrimcavusoglu
Copy link
Copy Markdown
Owner

Summary

  • When skern is installed via go install, version info is not injected via ldflags, so skern version reports dev (commit: none, built: unknown)
  • Added fallback to runtime/debug.ReadBuildInfo() in internal/cli/version.go that reads BuildInfo.Main.Version, vcs.revision, and vcs.time when ldflags are not set
  • Goreleaser/Makefile builds remain authoritative — the fallback only activates when Version == "dev"

Test plan

  • 6 table-driven tests covering: ldflags already set, build info unavailable, full go install info, (devel) version, version without VCS info, empty VCS values
  • Manual: go install github.com/devrimcavusoglu/skern/cmd/skern@latest then skern version shows correct version

Closes #71

🤖 Generated with Claude Code

When ldflags are not set (e.g. `go install`), populate Version, Commit,
and Date from Go's embedded build info instead of showing "dev".

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@devrimcavusoglu devrimcavusoglu merged commit 5ca33c2 into main Apr 13, 2026
4 checks passed
@devrimcavusoglu devrimcavusoglu deleted the fix/71-version-go-install branch April 13, 2026 00:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

skern version reports dev when installed via go install

1 participant